package com.classTest;
import java.util.concurrent.atomic.AtomicReference;
class Book{
    private String title;
    private double price;
    public Book(String title,double price){
        this.title = title;
        this.price = price;
    }
    public String toString(){
        return "书名："+title+"，价格："+price;
    }
}

public class test04 {
    public static void main(String[ ] args)throws Exception{
    Book book = new Book("java",101.11);
    AtomicReference<Book>ref = new AtomicReference<Book>(book);
    ref.compareAndSet(book,new Book("java",101.11));
    System.out.println(ref.get());
    }
}
